//
//  LFBaseNavigationViewController.m
//  LoveFreshBee
//
//  Created by 王忠迪 on 10/15/16.
//  Copyright © 2016 王忠迪. All rights reserved.
//

#import "LFBaseNavigationViewController.h"
#import "LFNavBtn.h"


@interface LFBaseNavigationViewController ()

@end

@implementation LFBaseNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationBar setBarTintColor:[UIColor colorWithRed:253/255.0 green:212/255.0 blue:50/255.0 alpha:1]];
    
    [self setupUI];
}

- (void)setupUI {
    
}


-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.viewControllers.count > 0) {
        
        viewController.hidesBottomBarWhenPushed = YES;
        
    }else {
        
        LFNavBtn * sao = [[LFNavBtn alloc]initWithFrame:CGRectMake(0, 0, 35, 35)];
        [sao setTitle:@"扫一扫" forState:UIControlStateNormal];
        [sao setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        sao.titleLabel.font = [UIFont systemFontOfSize:10];
        [sao setImage:[[UIImage imageNamed:@"icon_black_scancode"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        [sao addTarget:self action:@selector(saoyisao) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem * saoItem = [[UIBarButtonItem alloc]initWithCustomView: sao];
        viewController.navigationItem.leftBarButtonItem = saoItem;
        
        
        LFNavBtn * search = [[LFNavBtn alloc]initWithFrame:CGRectMake(0, 0, 35, 35)];
        [search setTitle:@" 搜  索" forState:UIControlStateNormal];
        [search setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        search.titleLabel.font = [UIFont systemFontOfSize:10];
        [search setImage:[[UIImage imageNamed:@"icon_search"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        [search addTarget:self action:@selector(search) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem * searchItem = [[UIBarButtonItem alloc]initWithCustomView: search];
        viewController.navigationItem.rightBarButtonItem = searchItem;
    }

    [super pushViewController:viewController animated:animated];
}




-(void)saoyisao{
    NSLog(@"saoyisao~~~~~");
}



-(void)search{
    NSLog(@"search~~~~~");
}



@end
